import Vue from 'vue'
import VueRouter from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)

Vue.use(VueRouter)

export const constantRouterMap = [
  {
    path: '/',
    name: 'Home',
    redirect: '/category'
  },
  {
    path: '/demo',
    name: 'Demo',
    component: _import('demo')
  },
  {
    path: '/introduce',
    name: 'Introduce',
    component: _import('introduce/introduce')
  },
  {
    path: '/culture',
    name: 'Culture',
    component: _import('culture/culture')
  },
  {
    path: '/category',
    name: 'Category',
    component: _import('category/category')
  },
  {
    path: '/products/:categoryId',
    name: 'Products',
    component: _import('products/products')
  },
  {
    path: '/detail/:productId',
    name: 'Detail',
    component: _import('detail/detail')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_PATH,
  routes: constantRouterMap
})

export default router
